package com.ztgf.pay.service;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.ztgf.pay.models.vo.PayBankInfoVO;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.BeanUtils;
import javax.annotation.Resource;
import com.ztgf.pay.common.config.YmlConfig;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.ztgf.pay.mapper.PayBankInfoMapper;
import com.ztgf.pay.models.service.IPayBankInfoService;
import com.ztgf.pay.models.bo.PayBankInfoSaveBO;
import com.ztgf.pay.models.dto.PayBankInfoDTO;

import java.util.List;

/**
 * 银行信息表控制器
 *
 * @author mxli
 * @Date 2020-08-20 16:48:00
 */
@DubboService
public class PayBankInfoServiceImpl extends ServiceImpl<PayBankInfoMapper, PayBankInfoDTO> implements IPayBankInfoService{

    @Resource
    private YmlConfig ymlConfig;

    @Override
    public boolean add(PayBankInfoSaveBO saveBO) {
        PayBankInfoDTO dto = new PayBankInfoDTO();
        BeanUtils.copyProperties(saveBO,dto);
        return this.insert(dto);
    }

    @Override
    public PayBankInfoDTO getByAddress(String bankAddress) {
        Wrapper wrapper = new EntityWrapper();
        wrapper.eq("FKHMC1", bankAddress);
        return this.selectOne(wrapper);
    }

    @Override
    public PayBankInfoVO getByNo(String bankNo) {

        return this.baseMapper.getByNo(bankNo);
    }

    @Override
    public List<PayBankInfoVO> queryList(String bankNo, String areaCode) {
        return this.baseMapper.queryList(bankNo, areaCode);
    }


}
